import 'package:flutter/material.dart';
import '../model/ex_stream.dart';
import '../widget/loading_gradient_btn.dart';
import 'dart:async';

class PageTest extends StatelessWidget {
  ExStream<bool> btnStream;
  PageTest() {
    this.btnStream = ExStream(false);
  }

  void btnPressed() {
    this.btnStream.setData(true);
  }
  void btnUnLoading() {
    this.btnStream.setData(false);
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        Text('4324ff'),
        LoadingGradientBtn(exStream: this.btnStream, width: 100, height: 30, pressed: (){
          this.btnPressed();
          //5s后结束loading
          Timer(const Duration(seconds: 5), () {this.btnUnLoading();});
        },child: Text('test'))
      ]
    );
  }
}